#include <bits/stdc++.h>
using namespace std;

#define ONLINE_JUDGE

#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

typedef long long LL;

#define int long long

const int N = 1e5+50;

int n, a[N];
int s[N];
int l;

signed main()
{
	scanf("%lld", &n);
	for (int i=0; i<n; ++i)
	{
		int x, y;
		scanf("%lld%lld", &x, &y);
		a[i] = min(x, y);
	}
	scanf("%lld", &l); l *= 2;
	sort(a, a+n);
	s[0] = a[0];
	for (int i=1; i<n; ++i)
		s[i] = s[i-1] + a[i];
	int ans = 1;
	// for (int i=0; i<n; ++i)
	// 	dbg(i, a[i], s[i]);
	for (int x=n; x>=2; --x)
	{
		int t = a[x-1] + a[x-2];
		if (x > 2) t += 2 * s[x-3];
		// dbg(t, x, l);
		if (t < l)
		{
			ans = x;
			break;
		}
	}
	printf("%lld\n", ans);

	return 0;
}